import { View, RichText } from "@tarojs/components";
import { useDidShow, useRouter, setNavigationBarTitle } from "@tarojs/taro";
import { https } from "@utils/index";
import { useState } from "react";

const FrequentlyAskedQuestionsDetail = () => {
  const { params } = useRouter();
  const [detail, setDetail] = useState<Questions>();
  useDidShow(() => {
    getDetail();
  });
  const getDetail = () => {
    https.getCourseDetail(params).then((res) => {
      setNavigationBarTitle({ title: res?.data?.data?.name || "问题详情" });
      setDetail(res?.data?.data);
    });
  };
  return (
    <View className="min-h-full box-border pb-[10px]">
      <View className="text-[36px] font-bold m-[30px] mb-0">
        {detail?.name}
      </View>
      <View className="p-[30px]">
        <RichText
          className="text-[28px] leading-[60px] text-[#666]"
          nodes={detail?.content}
        />
      </View>
    </View>
  );
};

export default FrequentlyAskedQuestionsDetail;
